//
//  AMBaseTableViewCell.m
//  WeiDu_1_0
//
//  Created by Fox Guo on 15-3-28.
//  Copyright (c) 2015年 ShenOu Tech. All rights reserved.
//

#import "HOBaseTableViewCell.h"
#import "HOUtils.h"

@implementation HOBaseTableViewCell
@synthesize cellHeight;
@synthesize cellWidth;

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];
    
    // Configure the view for the selected state
}

- (void)initWithWidth:(CGFloat)width
{
}


- (void)initUI
{
}
- (void)setMessage:(HOBaseMessageEntity *)message
{
    
}
#pragma mark - -- set background, include selected background.
- (void)setBgColor:(UIColor *)color
{
    
    if(bgView == nil)
    {
        bgView = [[UIView alloc]
                       initWithFrame:CGRectMake(0,
                                                0,
                                                cellWidth,
                                                cellHeight)];
        self.backgroundView = bgView;
    }
    [bgView setBackgroundColor:color];
}

- (void)setSelColor:(UIColor *)color
{
    
    if(selView == nil)
    {
        selView = [[UIView alloc]
                  initWithFrame:CGRectMake(0,
                                           0,
                                           cellWidth,
                                           cellHeight)];
        self.backgroundView = selView;
    }
    [selView setBackgroundColor:color];
}

#pragma mark - -- set line.

- (void)setTopLineColor:(UIColor *)color
{
    if(topLineView == nil)
    {
        topLineView = [[UIView alloc]
                       initWithFrame:CGRectMake(0,
                                                0,
                                                [HOUtils getScreenWidth],
                                                [HOUtils defaultOnePixelConversion])];
        [self.contentView addSubview:topLineView];
    }
    [topLineView setBackgroundColor:color];
}

- (void)setBottomLineColor:(UIColor *)color
{
    if(bottomLineView == nil)
    {
        bottomLineView = [[UIView alloc]
                       initWithFrame:CGRectMake(0,
                                                cellHeight - 1,
                                                
                                                [HOUtils getScreenWidth],
                                                [HOUtils defaultOnePixelConversion])];
        [self.contentView addSubview:bottomLineView];
    }
    [bottomLineView setBackgroundColor:color];
}

- (BOOL)canBecomeFirstResponder{
    return YES;
}

- (void)dealloc
{
	for (UIGestureRecognizer *recognizer in self.gestureRecognizers) {
		[self removeGestureRecognizer:recognizer];
	}
    if(bgView)
	{
		[HOUtils removeFromSuperViewForViews:bgView];
        [bgView release];
        bgView = nil;
    }
    if(selView)
	{
		[HOUtils removeFromSuperViewForViews:selView];
        [selView release];
        selView = nil;
    }
	
    if(topLineView)
	{
		[HOUtils removeFromSuperViewForViews:topLineView];
        [topLineView release];
        topLineView = nil;
    }
    if(bottomLineView)
	{
		[HOUtils removeFromSuperViewForViews:bottomLineView];
        [bottomLineView release];
        bottomLineView = nil;
    }
    
    [super dealloc];
}


@end
